package helper

import "fmt"

func StorageSize(size int64) string {
	const (
		_          = iota
		KB float64 = 1 << (10 * iota)
		MB
		GB
	)

	switch {
	case size >= int64(GB):
		return fmt.Sprintf("%.2f GB", float64(size)/GB)
	case size >= int64(MB):
		return fmt.Sprintf("%.2f MB", float64(size)/MB)
	case size >= int64(KB):
		return fmt.Sprintf("%.2f KB", float64(size)/KB)
	default:
		return fmt.Sprintf("%d B", size)
	}
}
func HyperLink(value, title string) string {
	return fmt.Sprintf("<a href=\"%s\">%s</a>", value, title)
}
